package com.ys.lambda;

import org.junit.Test;

/**
 * <p>@description:</p>
 *
 * @author shuangyang
 * @version 1.0
 * @date 18-2-1 下午8:28
 */
public class TestUserSelector {

    public static void main(String[] args) {

    }


    @Test
    public void stream() {
        //使用lambada表达式 代码更简洁

        User user = new User();

        user.setName("小明");
        // testUserSelect(user->{});

        System.out.println(testUserSelect(() -> {
            if (user.getName().equals("小明")) {
                return user;
            }
            return null;
        }));
    }


    private User testUserSelect(UserSelector<User> userSelector) {
        return userSelector.execute();
    }
}
